<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<style>
  .container {
    width: 200px;
    height: 100px;
    border: 1px solid red;
  }
  .test {
    width: 10px;
    height: 10px;
    border: 1px solid deepskyblue;
    /*? margin和padding都是相对于父元素宽度的*/
    margin-top: 50%;
  }
</style>
<body>
<div class="container">
  <div class="test"></div>
</div>

<script>

</script>
</body>

</html>
